

<h1>{{category.name}}</h1>
<div class="forum">
<div class="forum-messages">
{{foreach m in messages}}

<div style="padding-left: {{MUL1(20):m.level}}px"><div class="item"><a name="{{m.id}}"></a>
	<div class="date">
		{{m.date_cr}}<br/> 
		
		{{if m.id==fields.root_message_id}} 
			<form action="{{action}}" method="POST" enctype="multipart/form-data" name="sticker" >
				<input type='hidden' name="mode" value="sticked_message" />
				<input type="hidden" name="root_message_id" value="{{fields.root_message_id}}"/>
				<input type="hidden" name="category_id" value="{{fields.category_id}}"/>
				<input type='hidden' name="massege_id" value="{{m.id}}" />
				<input type="hidden" name="ajaj" value="1"/>
				<input type="checkbox"  {{if m.sticked}} checked = "checked" {{/if}}  name="sticked" />
				<input type="submit" value="Прилепить"  onclick="ajaj_form(document.forms.sticker);return false;"/>
			</form>
					  
		{{/if}} 
		
		
		
	</div>
	<img src="{{if m.user_cr_avatar_id_url}}{{preview("2"):m.user_cr_avatar_id_url}}{{/if}}{{unless m.user_cr_avatar_id_url}}/shared/icons/forum_no_avatar.png{{/unless}}" />
	<div class="user-name">{{m.user_cr_name}}:</div>
	<div class="title">{{m.title}}</div>
	<div class="body">{{m.body}}</div>
	<div class="cl"></div>
	
	<a href="#" onclick="answer({{m.id}},'{{m.user_cr_name}}','{{m.title}}'); upper();return false;">Ответить</a>
	
	 <form action="{{action}}" method="POST" enctype="multipart/form-data" name="delmsg" >
	 	<input type='hidden' name="mode" value="message_delete" />
	 	<input type="hidden" name="root_message_id" value="{{fields.root_message_id}}"/>
		<input type="hidden" name="category_id" value="{{fields.category_id}}"/>
		<input type="hidden" name="msg_id" value="{{m.id}}">
		<input type="hidden" name="ajaj" value="1"/>
	 	<input class="submit" type="submit" value="Удалить" onclick="ajaj_form(this.parentNode);return false;"/>
	 </form>
	
	
</div>


</div>

{{/foreach}}
</div>
<div class="new-msg">
	<a name="upper"></a>	
	<form action="{{action}}" method="POST" enctype="multipart/form-data" name="gbfrm">
		<input type="hidden" name="mode" value="message_write"/>
		<input type="hidden" name="root_message_id" value="{{fields.root_message_id}}"/>
		<input type="hidden" name="category_id" value="{{fields.category_id}}"/>
		<input type="hidden" name="parent_id" value=""/>
		<input type="hidden" name="ajaj" value="1"/>
		
		<div class="field">
			<div class="title">{{!title}}</div>
			<input type="text" name="title" />
		</div>
		
		<div class="field">
			<div class="title">{{!body}}</div>
			<textarea  name="body"  rows="10" cols="60"></textarea>
		</div>
		
		<input class="submit" type="submit" value="Написать" onclick="ajaj_form(document.forms.gbfrm);return false;"/>
		<div class="cl"></div>
	</form>
</div>



</div>

<script>
$(".forum .new-msg").hide();
function answer(msg_id,user_name,user_theme)
{
	$(".forum .new-msg").show();
	document.forms.gbfrm.parent_id.value=msg_id;
	$(".forum input[name='title']").val("RE: "+user_name+" - "+user_theme);

};

function upper(){
	window.location.href = '#upper';
};

function not_login(){
	alert("Для удаления сообщения необходимо зарегистрироваться в системе или у вас недостаточно прав для этого.");
};

</script>
